<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
        '<div contenteditable dir="rtl" id="target">',
            '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';
        const target = selection.document.getElementById('target');
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + 3,
            selection.computeLeft(target) + 3);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    [
        '<div contenteditable dir="rtl" id="target">',
            '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;|',
        '</div>',
    ],
    'Click left');
selection_test(
    [
        '<div contenteditable dir="rtl" id="target">',
            '\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ],
    selection => {
        if (!window.eventSender)
          throw 'This test requires eventSender.';
        const target = selection.document.getElementById('target');
        eventSender.mouseMoveTo(
            selection.computeLeft(target) + target.offsetWidth - 3,
            selection.computeLeft(target) + 3);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    [
        '<div contenteditable dir="rtl" id="target">',
            '|\u05e9;\u05d3;\u05d4; \u05d1;\u05d5;\u05e8;',
        '</div>',
    ],
    'Click right');
</script>
